$(function(){
	var kinship
	$("#addEditor").hide()
	$(".change_relat li").on("click",function(){
		$("#addEditor").show()
		$(".relation").hide()
		kinship = $(this).children(".kinship").val()
		console.log(kinship)
	})
	
	$(".addEditor-head img").on("click",function(){
		$("#addEditor").hide()
		$(".relation").show()
	})
	
	$("#sureEdit").on("click",function(){
		var lastname=$("input[name=lastname]").val();
	    var fristname=$("input[name=fristname]").val();
	    var gender=$('input:radio:checked').val();
	     $("#isAlive").each(function(){
	        if(this.checked){
	            alive=$(this).val();
	        }
	    });
	    var borntime=$("#processTime1").val();
	    var tel=$("#tel").val();
	    var wechat=$("#wx").val();
		var url = "/api/v1/familytree/showTree"
		
		var data = {
			"kinship":kinship,
			"lastname":lastname,
			"fristname":fristname,
			"alive":alive,
			"gender":gender,
			"borntime":borntime,
			"tel":tel,
			"wechat":wechat
		}
		
		$.post(url,data,function(request){
			
		})
	})
	
	//验证姓名
	/*function isChinaName(name){
	    var pattern = /^[\u4E00-\u9FA5]{1,6}$/;
	    return pattern.test(name);
	}*/
	// 验证手机号
	/*function isPhoneNo(phone) {
	    var pattern = /^1[34578]\d{9}$/;
	    return pattern.test(phone);
	}
*/
	
})
